/**
 * 将字符串 "2020年1月1日"类型的字符串转化为日期类型
 * 2020/1/1 00:00:00
 *   2020-01-01 00:00:00
 */
export function stringDateFormat() {
  const DateFormat = (stringData: string) => {
    if (stringData.search("年") != -1) {
      stringData = stringData.replace("年", "/");
      stringData = stringData.replace("月", "/");
      stringData = stringData.replace("日", "/");
      stringData = stringData.replace("时", ":");
      stringData = stringData.replace("分", ":");
      stringData = stringData.replace("秒", ":");
    }
    if (stringData.search("-") != -1) {
      stringData = stringData.replaceAll("-", "/");
    }
    console.log(stringData);
    console.log(new Date(stringData));
    return new Date(stringData);
  };
  return {
    DateFormat,
  };
}
